package com.cavasmonitor.db;

public class CavasDB {

	/*
	 * Estructura de la Base de datos SQLLite
	 */

	public static final String KEY_ROWID = "_id";
	
	/*
	 * Nombre de las tablas
	 */

	protected static final String T_USUARIOS = "t001_usuarios";
	protected static final String T_EQUIPOS = "t002_equipos";
	protected static final String T_TEMPERATURA = "t003_equipos";
	protected static final String T_ALARMAS = "t004_alarmas";
	protected static final String T_CONFIG = "t005_config";

	protected static final String CREATE_USUARIOS = "create table "+T_USUARIOS+" ("+KEY_ROWID+" integer primary key autoincrement, "			
			+ "nb_usuario text null, " 
			+ "tx_pass text null, "
			+ "co_rol number not null); ";
	
	protected static final String CREATE_EQUIPOS = "create table " + T_EQUIPOS + " ("+KEY_ROWID+" integer primary key autoincrement, "			
			+ "nb_nombre text null, " 
			+ "tx_desc text null, "
			+ "nu_punto number not null); ";
	
	protected static final String CREATE_TEMPERATURA = "create table " + T_TEMPERATURA + " ("+KEY_ROWID+" integer primary key autoincrement, "			
			+ "fk_equipo number not null, " 
			+ "tx_fecha number null, "
			+ "in_ultima text null, "
			+ "nu_valor real not null); ";
	
	protected static final String CREATE_ALARMAS = "create table " + T_ALARMAS + " ("+KEY_ROWID+" integer primary key autoincrement, "			
			+ "fk_equipo number not null, " 
			+ "nu_tipo number null, "
			+ "nu_min real not null, " 
			+ "nu_max real not null); ";
	
	protected static final String CREATE_CONFIG = "create table " + T_CONFIG + " ("+KEY_ROWID+" integer primary key autoincrement, "			
			+ "tx_key text not null, " 
			+ "tx_value text not null); ";
	/*
	 * Parametros de Configuracion
	 */
	protected static final String DATABASE_NAME = "cavas_monitor";
	protected static final int DATABASE_VERSION = 2;

	
}
